#!/bin/bash
#DSUB -n cp2k_01
#DSUB --job_type cosched
#DSUB -N 1
#DSUB -R cpu=64;mem=496000;gpu=0
#DSUB -A root.account-hjc
#DSUB -q root.default
#DSUB -d "106-01:GRAPES" 
#DSUB -T "1h" 
#DSUB -l normal
#DSUB -o %J_out.log
#DSUB -e %J_err.log


hr_path=/share/home/top_software/sunqian/hpcrunner-old
export HOSTFILE=hostfile.gfs
rm -f $HOSTFILE
touch $HOSTFILE
`cat ${CCSCHEDULER_ALLOC_FILE} | sort | awk -v fff="$HOSTFILE" '{}
{
        split($0, a, " ")
        if (length(a[1]) >0 && length(a[3]) >0) {
                print a[1]" slots="64 >> fff
        }
}'`

echo "hmpi hostfile $HOSTFILE generated:"
echo "-----------------------"
cat $HOSTFILE
echo "-----------------------"

##配置环境变量
os=`cat /etc/os-release|grep VERSION_ID|awk -F \" '{print $2}'`


module purge
module use $hr_path/software/modulefiles
module load bisheng/2.1.0
module load hmpi/1.1.1
module load gsl/2.6






cd $hr_path/cp2k-7.1.0/exe/Linux-arm-clang

echo "-----------------------"
echo $os
echo "-----------------------"

time -p numactl -N 0,1 -m 0,1 mpirun --allow-run-as-root -N 64 --hostfile $HOSTFILE -x OMP_NUM_THREADS=1 cp2k.psmp $hr_path/cp2k-7.1.0/benchmarks/QS/H2O-256.inp
